/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.sys.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.chlitina.store.common.config.Global;
import com.chlitina.store.common.persistence.Page;
import com.chlitina.store.common.web.BaseController;
import com.chlitina.store.modules.sys.entity.StoreLogin;
import com.chlitina.store.modules.sys.service.StoreLoginService;

/**
 * ipad地址绑定Controller
 * @author liujiang
 * @version 2013-09-22
 */
@Controller
@RequestMapping(value = Global.ADMIN_PATH+"/sys/storeLogin")
public class StoreLoginController extends BaseController {

	@Autowired
	private StoreLoginService storeLoginService;
	
	@ModelAttribute
	public StoreLogin get(@RequestParam(required=false) Long id) {
		if (id != null){
			return storeLoginService.get(id);
		}else{
			return new StoreLogin();
		}
	}
	
	@RequestMapping(value = {"list", ""})
	public String list(StoreLogin storeIpad, HttpServletRequest request, HttpServletResponse response, Model model) {
        Page<StoreLogin> page = storeLoginService.find(new Page<StoreLogin>(request, response), storeIpad); 
        model.addAttribute("page", page);
		return "modules/sys/storeLoginList";
	}

	@RequestMapping(value = "form")
	public String form(StoreLogin storeIpad, Model model) {
		model.addAttribute("storeIpad", storeIpad);
		return "modules/sys/storeLoginForm";
	}
}
